﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace HomeBuyerTools.Views.ClosingCostAnalysis
{
    public partial class ClosingCostAnalysis : PhoneApplicationPage
    {
        public ClosingCostAnalysis()
        {
            InitializeComponent();
        }

       
        private void ApplicationBarCalculate_Click(object sender, EventArgs e)
        {
            double selling = Convert.ToDouble(txtSellingPriceOfProperty.Text);
            double down=Convert.ToDouble(txtDownpayment.Text);
             double mortgage=0;
            double total=0;
             if (selling != 0 && down != 0)

                 mortgage = (selling) - (down);

             if (txtBroker.Text != "" && txtAppraiser.Text != "" && txtAttorney.Text != "" && txtSurveyor.Text != "" && txtTitleSearcher.Text != "")
                 total = Convert.ToDouble(txtBroker.Text) + Convert.ToDouble(txtAppraiser.Text) + Convert.ToDouble(txtAttorney.Text) + Convert.ToDouble(txtSurveyor.Text) + Convert.ToDouble(txtTitleSearcher.Text);
             
             NavigationService.Navigate(new Uri("/Views/ClosingCostAnalysis/Result.xaml?mortgage=" + mortgage + "&total=" + total  , UriKind.Relative));

        }
        
    }

}